<template>
	<div class="collectionAblum scrollbar size"  id="style-2">
		<div class="block" v-for="ablum in allData" :key="ablum.shareId" @click="showViews(ablum)">
		    <el-image
		      :src="$store.state.baseHttp + ablum.shareCoverPath"
		      fit="cover">
					
					</el-image>
					<span class="ablumName">{{ablum.shareName}}</span>
					<div class="TreenSign">
						<span class="updataTime">{{ablum.updateTime}}</span>
						<p class="three">
							<img src="@/assets/pngImg/dianzan.png" alt="">
							<span>{{ablum.likesCount}}</span>
							<img src="@/assets/pngImg/collection.png" alt="">
							<span>{{ablum.colloctionsCount}}</span>
							<img src="@/assets/pngImg/pinglun.png" alt="">
							<span>{{ablum.reviewsCount}}</span>
						</p>
					</div>
		  </div>
	</div>
</template>

<script>
	export default{
		data(){
			return{ 
				allData:[]
			}
		},
		created() {
			this.getdata()
		},
		activated() {
			this.getdata()
		},
		methods:{
			getdata(){
				let Cdata = this.$shareClass.CUserShare(this.$store.state.toUserId)
				this.$http.get('/api/share',{params:Cdata}).then(res=>{
					let Ddata = this.$shareClass.DUserShare(res.data.shares)
					this.allData = Ddata
				})
			}, 
			updataTime(time){
				let time1 =  time.split('T')[0].split('-').join('.')
				let time2 =  time.split('T')[1].split('-')[0]+':'+time.split('T')[1].split('-')[1]
				return time1 +'\b'+'\b'+ time2
			},
			showViews(ablum){
				window.open(this.$store.state.localhost+'shareView/'+ablum.shareId)
			}
		}
	}
</script>

<style scoped="scoped">
	.size{
		min-height: 85%;
		min-width: 99%;
	}
	.collectionAblum{
		width: 100%;
		height: 95%;
		padding-top:25px;
		display: flex;
		flex-wrap: wrap;
		background-color: #f3f9f9;
	}
	.block{
		position: relative;
		height: 210px;
		width: 28%;
		border-radius: 5px;
		overflow: hidden;
		margin-left: 40px;
		margin-bottom:40px;
		border: #ecefef solid 2px;
		cursor: pointer;
	}
	.block:nth-of-type(3n){
		margin-right: 0;
	}
	.el-image{
		height:100%;
		width:100%;
	}
	.block .TreenSign{
		position: absolute;
		height: 64px;
		width: 100%;
		bottom: 0;
		left: 0;
		background-color: rgba(0,0,0,.3);
		color: white;
	}
	.bottomHead{
		width: 50px;
		height: 50px;
		overflow: hidden;
		border: solid #FFFDEF 1px;
		border-radius: 50%;
		margin-left: 10px;
		margin-top: 5px;
	}
	.bottomHead img{
		width: 50px;
		height: 50px;
	}
	.updataTime{
		position: absolute;
		bottom: 2px;
		right: 10px;
		font-size: 13px;
		color: #f3f9f9;
	}
	.ablumName{
		position: absolute;
		text-align: center;
		display: block;
		width: 100%;
		top: 0;
		font-size: 20px;
		padding: 5px 0;
		left: 0;
		background-color: rgba(0,0,0,.3);
		color: #fffce7;
	}
	.collectionIcon{
		position: absolute;
		right: 5px;
		top: 10px;
		width: 25px;
		height: 25px;
		cursor: pointer;
	}
	.three{
		position: absolute;
		width: 100%;
		text-align: left;
		left: 10px;
		bottom: 20px;
		font-size: 14px;
	}
	.three img {
		width: 25px;
		height: 25px;
		margin-left: 15px;
		margin-right: 5px;
		vertical-align: bottom;
	}
</style>
